package model

// MenuRule 菜单和权限规则表
type MenuRule struct {
	Current
	Pid       int    `json:"pid" gorm:"type:int;comment:'上级菜单'"`
	Type      string `json:"type" gorm:"type:enum('menu_dir','menu','button');comment:'类型:menu_dir=菜单目录,menu=菜单项,button=页面按钮'"`
	Title     string `json:"title" gorm:"type:varchar(50);comment:'标题'"`
	Name      string `json:"name" gorm:"type:varchar(50);comment:'规则名称'"`
	Path      string `json:"path" gorm:"type:varchar(100);comment:'路由路径'"`
	Icon      string `json:"icon" gorm:"type:varchar(50);comment:'图标'"`
	MenuType  string `json:"menu_type" gorm:"type:enum('tab','link','iframe');comment:'菜单类型:tab=选项卡,link=链接,iframe=Iframe'"`
	Url       string `json:"url" gorm:"type:varchar(255);comment:'Url'"`
	Component string `json:"component" gorm:"type:varchar(100);comment:'组件路径'"`
	Keepalive int    `json:"keepalive" gorm:"type:enum('1','0');comment:'缓存:0=关闭,1=开启'"`
	Extend    string `json:"extend" gorm:"type:enum('none','add_rules_only','add_menu_only');comment:'扩展属性:none=无,add_rules_only=只添加为路由,add_menu_only=只添加为菜单'"`
	Remark    string `json:"remark" gorm:"type:varchar(255);comment:'备注'"`
	Weigh     any    `json:"weigh" gorm:"type:int;comment:'权重(排序)'"`
	Status    string `json:"status" gorm:"type:enum('1','0');comment:'状态:0=禁用,1=启用'"`
}

func (MenuRule) TableName() string {
	return "system_menu"
}
